# 设置变量
# 基础镜像
FROM node:lts-alpine AS build
# FROM gitea.lntu.edu.cn/youling/nodejs AS builder
# FROM node:20 AS builder

WORKDIR /app
COPY . .
# RUN pnpm up -L && \
#     pnpm run build


#替换aliyun源，并更新  --no-cache 表示不缓存

RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.volces.com/g' /etc/apk/repositories && \
    apk update --no-cache && \
    npm config set registry https://registry.npmmirror.com && \
    npm -g i pnpm && \
    pnpm up -L && \
    pnpm run build


###
FROM caddy AS deploy
#设置时区
ENV TZ="Asia/Shanghai"
WORKDIR /app
COPY --from=build /app/dist/. /usr/share/caddy

EXPOSE 80
